#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import "Location.h"
#import "AddressAnnotation.h"
#import "BuildingDataUtility.h"
#import "FileUtilities.h"
#import "BuildingCollection.h"
#import "MapBuildingSearchDelegate.h"
#import "SFUEventSearchEngine.h"
#import "GPSLocation.h"
#import "MapSearchUtility.h"
#import "SFUEvent.h"
#import "EventSearchView.h"
#import "MapSearchListViewer.h"
#import "SFUConstants.h"
#import "PinNoteManager.h"
#import "BusDirectoryManager.h"
#import "AddressAnnotationCollection.h"
#import "PointOfInterestDataUtility.h"
#import "ValueSelectorView.h"
#import "MapAppSettingsView.h"
#import "FoursquareManager.h"
#import "BuildingViewer.h"
#import "Reachability.h"
#import "ReachabilityDelegate.h"
#import "POIAddressAnnotation.h"

#define ZERO 0

/**
 * This class represents the main view of the application. 
 *
 * It is responsible for displaying the map view and all its elements. Such 
 * elements include: annotations, callout bubbles, and current user location.
 *
 * Event, building, and pin note events are handled within this class.
 * 
 * @author      Justin Hollander
 * @author      James Lin
 * @version     1.4.4
 * @since       0.1.0
 * @see         MKMapViewDelegate
 * @see         MapBuildingSearchDelegate
 * @see         SFUEventSearchResponseDelegate
 * @see         PinNoteManagerDelegate
 * @see         MapPOISearchDelegate
 * @see         FoursquareManagerDelegate
 * @see         ReachabilityDelegate
 */
@interface MapViewController : UIViewController<MKMapViewDelegate,
												MapBuildingSearchDelegate, 
												UITabBarDelegate, 
												SFUEventSearchResponseDelegate, 
												UIAccelerometerDelegate, 
												PinNoteManagerDelegate,
												MapPOISearchDelegate, 
												FoursquareManagerDelegate, 
										 	    ReachabilityDelegate> {
	MKMapView*         mapView;            // Map view of the application
	UITabBar*          mapTabBar;          // Tab bar for feature functionality traversal
	AddressAnnotation* addAnnotation;      // Contains annotation pin for the map
	BOOL               isBuildingSearch;   // Flag for callout bubble button visibility
	NSMutableArray*    pinNotes;           // Temporary collection of pin notes
	NSOperationQueue*  queue;              // Queue for cache operations
	NSUInteger         reminderTimerCount; // Counter for reminder prompt's interval checks
	NSTimer*           reminderTimer;      // Timer for reminder prompt
	AddressAnnotation* targetAnnotation;   // Reference to target annotation
	NSTimer*           reachabilityTimer;  // Timer for internet connectivity checks
}

@property (nonatomic, retain) MKMapView* mapView;
@property (nonatomic, retain) UITabBar* mapTabBar;
@property (nonatomic, retain) UITabBarItem* searchItem;
@property (nonatomic, retain) UITabBarItem* settingsItem;
@property (nonatomic, retain) UITabBarItem* pinNotesItem;
@property (nonatomic, retain) UITabBarItem* bookmarksItem;
@property (nonatomic, retain) UITabBarItem* fourSquareItem;
@property BOOL isBuildingSearch;

/**
 * Reset the persistent pin note collection.
 */
- (void)resetPinNotes;

/**
 * Begin caching new event data.
 */
- (void)runEventCaching;

/**
 * Animate the map view to the default map region.
 */
- (void)setDefaultMapRegion;

@end
